package ca.ets.osgi.conferenceroomservice;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import ca.ets.osgi.conferenceroominterface.IConferenceRoomService;

public class ConferenceRoomService implements IConferenceRoomService {
	
	
	public ConferenceRoomService(){}

	@SuppressWarnings("unchecked")
	@Override
	public Object getRoomByCharacteristics(String surface,
			boolean isProjectorAvailable) {
		System.out.println("[Trying to find rooms matching these description: " + "Surface: " + surface + ",is there a projector: " + isProjectorAvailable + "]");
		RoomReader rreader = new RoomReader();
		rreader.openList();
		
		ListRooms lr = ListRooms.getInstance();
        List list = lr.getListRoomsWithCaracteristics(true, surface, isProjectorAvailable);
		if(list ==null){
			System.out.println("No room were found with theses description");
			return list;
		}
        Collections.sort(list);
        return list;
	}
	
	

}
